home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CUCD / Kids / MathTeacher / Mathematics < prev    next >
Encoding:
Text File  |  1998-03-19  |  3.0 KB  |  108 lines

  1. /* Optimized with RexxOpt 1.7 */
  2.  
  3. if ~show('L',"rexxreqtools.library") then
  4. if ~addlib('rexxreqtools.library',0,-30,0) then;do
  5. say "Error... I need  Libs:rexxreqtools.library"
  6. exit
  7. end
  8. if ~show('L',"rexxtricks.library") then
  9. if ~addlib('rexxtricks.library',0,-30,0) then;do
  10. say "Error... I need  Libs:rexxtricks.library"
  11. exit
  12. end
  13. R='0A'X
  14. SIGNAL ON SYNTAX
  15. SIGNAL ON BREAK_C
  16. Call rtezrequest("ARexx-Mathematics 1.0"||R||"© 1998 by Heiko Schröder","_Start|_Cancel","Information")
  17. If result=0 then Exit
  18. Do while 1
  19. Call rtezrequest("What do you like?","_Addition|_Subtraction|_Multiplication|_Division","Question")
  20. rechenart=result
  21. Call rtezrequest("Now you have to solve 10 exercises!","_Start|_Cancel","Before you start...")
  22. If result~=0 then;Do
  23. Select
  24. When rechenart=1 then;do
  25. ra=" + ";ende=20
  26. End
  27. When rechenart=2 then;do
  28. ra=" - ";ende=20
  29. End
  30. When rechenart=3 then;do
  31. ra=" * ";ende=2
  32. End
  33. Otherwise;do
  34. ra=" : ";ende=10
  35. End
  36. End
  37. i=0;Zeit=0
  38. Do x=1 to 5
  39. Do y=1 to 2
  40. i=i+1
  41. If rechenart=0 then;do
  42. zahl1.i=rxtr_rand(1,ende)
  43. zahl2.i=zahl1.i*rxtr_rand(1,ende)
  44. End
  45. Else;do
  46. zahl1.i=rxtr_rand(0*x*y,ende*x)
  47. zahl2.i=rxtr_rand(0*x*y,ende*x)
  48. End
  49. If (rechenart=2|rechenart=0) then
  50. If zahl1.i<zahl2.i then;do
  51. temp=zahl1.i
  52. zahl1.i=zahl2.i;zahl2.i=temp
  53. End
  54. text.i=zahl1.i||ra||zahl2.i
  55. Time('r')
  56. Call rtgetstring(,text.i,"Number "||i)
  57. Zeit=Zeit+Time('e')
  58. ergebnisuser.i=result
  59. If ergebnisuser.i='' then ergebnisuser.i="xxx"
  60. End
  61. End
  62. say "The result of the test"
  63. say "**********************"
  64. richtig=0
  65. Do i=1 to 10
  66. Select
  67. When rechenart=1 then ergebnis.i=zahl1.i+zahl2.i
  68. When rechenart=2 then ergebnis.i=zahl1.i-zahl2.i
  69. When rechenart=3 then ergebnis.i=zahl1.i*zahl2.i
  70. Otherwise ergebnis.i=zahl1.i/zahl2.i
  71. End
  72. If ergebnisuser.i=ergebnis.i then;do
  73. richtig=richtig+1
  74. say copies(" ",2-Length(zahl1.i))||zahl1.i||ra||copies(" ",2-Length(zahl2.i))||zahl2.i" = "copies(" ",3-Length(ergebnisuser.i))||ergebnisuser.i
  75. End
  76. Else say copies(" ",2-Length(zahl1.i))||""||zahl1.i||ra||copies(" ",2-Length(zahl2.i))||zahl2.i" = "copies(" ",3-Length(ergebnisuser.i))||ergebnisuser.i||" No it is: "copies(" ",3-Length(ergebnis.i))||ergebnis.i||""
  77. End
  78. NUMERIC DIGITS 4
  79. If richtig=10 then say "Congratulations! You solved correct all 10 exercises in "||Zeit||" seconds."
  80. else say "You solved correct "||richtig||" of 10 in "||Zeit||" seconds."
  81. say "Thats a quote of "||richtig/10*100||"% and "||Zeit/richtig||" secs per correct exercise."
  82. say ""
  83. say "Press any key to continue..."
  84. Parse Pull Keyword
  85. End
  86. Call rtezrequest("Do you want to continue?","_Yes|_No","Question")
  87. If result=0 then exit
  88. End
  89. SYNTAX:
  90. CALL quit('Error' rc 'in line' sigl '-' ERRORTEXT(rc)||R||SOURCELINE(sigl)||R||'Please contact the author...',20)
  91. BREAK_C:
  92. CALL quit('You breaked the session...',20)
  93. quit:
  94. PARSE ARG message,rcode
  95. IF app ~='00000000'x THEN;DO
  96. IF message ~='' THEN
  97. Call rtezrequest(message,"_Okay","ATTENTION")
  98. If ende1=0 then CALL TR_DELETEAPP(app1)
  99. If ende3=0 then CALL TR_DELETEAPP(app3)
  100. END
  101. ELSE
  102. IF message ~='' THEN;DO
  103. SAY message
  104. SAY
  105. OPTIONS PROMPT 'Please press <RETURN>.'
  106. PULL taste
  107. END
  108. EXIT